# -*- coding: utf-8 -*-
from selenium import webdriver
import unittest

class Test1(unittest.TestCase):
    driver = webdriver.Firefox()
#    driver.port = 5555
    driver.get("http://www.baidu.com")
#    driver.save_screenshot('C://b.jpg')         #截图
#    oldhandle = driver.current_window_handle
    implement = driver.find_element_by_xpath("//a[@id='lb']").click()
    implement = driver.find_element_by_xpath("//div[contains(concat(' ', @class, ' '), ' bd_dialog_handle ')]")
    print driver
    driver.switch_to_frame("login_iframe")
    #for handle in driver.window_handles:
    #        driver.switch_to_window(handle)
    implement = driver.find_element_by_name("username")
    implement.send_keys("zhengchunxi@foxmail.com")
    implement = driver.find_element_by_name("password")
    implement.send_keys("testMiaozhen")
    implement = driver.find_element_by_id("pass_login_input_submit_0").click()       
    driver.quit()    
    
if __name__ == "__main__":
    unittest.main()


